package domijn;

import java.util.ArrayList;

import daoDataFactory.DaoFactory;
import daoMySQL.MySQLGerecht;

public class Drank implements Comparable<Drank>{

	private Menu Menu;
	private Categorie Cat;
	private int DrId;
	private int DrNewNumber;
	private int DrOldNumber;
	private String DrName;
	private String DrPrice;
	private String DrDiscr;
	private ArrayList<Drank> arDrank;
	
	
	public Drank(Menu menu, Categorie cat,int drId, int drOldNumber,int drNewNumber,String drName, String drPrice, String drDiscr) {
		
		this.Menu = menu;
		this.Cat = cat;
		this.DrId = drId;
		this.DrNewNumber = drNewNumber;
		this.DrOldNumber = drOldNumber;
		this.DrName = drName;
		this.DrPrice = drPrice;
		this.DrDiscr = drDiscr;
		arDrank = new ArrayList<Drank>();
	}	
	
	
	public Menu getMenu() {
		return Menu;
	}
	public void setMenu(Menu menu) {
		Menu = menu;
	}
	
	public Categorie getCat() {
		return Cat;
	}
	public void setCat(Categorie cat) {
		Cat = cat;
	}

	public int getDrId() {
		return DrId;
	}

	public void setDrId(int drId) {
		DrId = drId;
	}
	
	
	public int getDrNewNumber() {
		return DrNewNumber;
	}
	public void setDrNewNumber(int drNewNumber) {
		DrNewNumber = drNewNumber;
	}

	public int getDrOldNumber() {
		return DrOldNumber;
	}
	public void setDrOldNumber(int drOldNumber) {
		DrOldNumber = drOldNumber;
	}

	public String getDrName() {
		return DrName;
	}

	public void setDrName(String drName) {
		DrName = drName;
	}

	public String getDrPrice() {
		return DrPrice;
	}

	public void setDrPrice(String drPrice) {
		DrPrice = drPrice;
	}
	
	public String getDrDiscr() {
		return DrDiscr;
	}

	public void setDrDiscr(String drDiscr) {
		DrDiscr = drDiscr;
	}
	
	public ArrayList<Drank> getArDrank() {
		return arDrank;
	}

	public void setArDrank(ArrayList<Drank> arDrank) {
		this.arDrank = arDrank;
	}
	/**@author stijn
	 * dit zijn onze getters en setters
	 */

	@Override
	public String toString() {
		return 
				"Het menu = " + Menu + "de categorie = " +Cat+ "het nieuwe nummer = "+ DrNewNumber + "het oude nummer = " + DrOldNumber + " de naam = " + DrName + "de prijs = " + DrPrice + "de beschrijving = " + DrDiscr;
	}
	
	@Override
	public int compareTo(Drank d) {
		int a = DrNewNumber;
		int b = d.getDrNewNumber();
		boolean c = a==b;
		if (c == false) {
			return a;
		}
		else{
			return b;
		}
	}
	
	/** 
	 * @param save slaat een drank op
	 * @see MySQLDrank	 
	 */
	public void save(){
		DaoFactory.getwokapplicatie().getDaoIDrank().save(this);
		System.out.println("save methode domijn drank");
	}
	
	/** 
	 * @param update slaat veranderingen van een drank op
	 * @see MySQLDrank	 
	 */
	public void update (){
		DaoFactory.getwokapplicatie().getDaoIDrank().update(this);
	}
	
	/** 
	 * @param delete verwijderd een drank
	 * @see MySQLDrank	 
	 */
	public void delete (){
		DaoFactory.getwokapplicatie().getDaoIDrank().delete(this);
	}
	
	/** 
	 * @param find zoekt een drank
	 * @see MySQLDrank	 
	 */
	public void find(){
		DaoFactory.getwokapplicatie().getDaoIDrank().find(this);
	}
}
